<template>
    <div class="reports">
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>用户管理</el-breadcrumb-item>
            <el-breadcrumb-item>用户列表</el-breadcrumb-item>
        </el-breadcrumb>

        <!-- 图表 -->
        <div id="main" style="height:600px;"></div>
    </div>
</template>

<script>
import * as echarts from 'echarts';
import _ from 'lodash'
import { getReports } from '../../http/api'
export default {
    data() {
        return {
            options: {
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'cross',
                        label: {
                            backgroundColor: '#E9EEF3'
                        }
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        boundaryGap: false
                    }
                ],
                yAxis: [
                    {
                        type: 'value'
                    }
                ]
            }
        }
    },
    async mounted() {
        const res = await getReports();
        const newoptions = _.merge(res, this.options)
        var myChart = echarts.init(document.getElementById('main'));
        myChart.setOption(newoptions);
    }
}
</script>

<style lang="scss" scoped>
.reports {
    background-color: #fff;
    border-radius: 4px;
    padding: 15px;
}
</style>